package com.example.springsecurityoauth2demo.controller;

import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Classname: UserController
 * @Description:
 * @Date: 2021/3/18 21:49
 * @Created: by Wang Xu
 */
@RestController
@RequestMapping("/user")
public class UserController {

    /**
     * @description: 获取当前用户
     * @param: [authentication]
     * @return: java.lang.Object
     * @author: wangxu
     * @date: 2021/3/18 21:51
     */
    @RequestMapping("/getCurrentUser")
    public Object getCurrentUser(Authentication authentication) {
        return authentication.getPrincipal();
    }
}
